return;
}
this.currentRequest = this.api.get( {
+ formatversion: 2,
action: 'query',
prop: [ 'info' ],
titles: titles
} ).done( function ( response ) {
- var index, curr, title;
- for ( index in response.query.pages ) {
- curr = response.query.pages[ index ];
- title = new ForeignTitle( curr.title ).getPrefixedText();
- this.existenceCache[ title ] = curr.missing === undefined;
+ $.each( response.query.pages, function ( index, page ) {
+ var title = new ForeignTitle( page.title ).getPrefixedText();
+ this.existenceCache[ title ] = !page.missing;
queue[ title ].resolve( this.existenceCache[ title ] );
- }
+ } );
}.bind( this ) );
};
switch ( searchType ) {
case CategorySelector.SearchType.OpenSearch:
this.api.get( {
+ formatversion: 2,
action: 'opensearch',
namespace: NS_CATEGORY,
limit: this.limit,
case CategorySelector.SearchType.InternalSearch:
this.api.get( {
+ formatversion: 2,
action: 'query',
list: 'allpages',
apnamespace: NS_CATEGORY,
}
this.api.get( {
+ formatversion: 2,
action: 'query',
prop: 'info',
titles: 'Category:' + input
} ).done( function ( res ) {
- var page,
- categories = [];
+ var categories = [];
- for ( page in res.query.pages ) {
- if ( parseInt( page, 10 ) > -1 ) {
- categories.push( res.query.pages[ page ].title );
+ $.each( res.query.pages, function ( index, page ) {
+ if ( !page.missing ) {
+ categories.push( page.title );
}
- }
+ } );
deferred.resolve( categories );
} ).fail( deferred.reject.bind( deferred ) );
}
this.api.get( {
+ formatversion: 2,
action: 'query',
list: 'categorymembers',
cmtype: 'subcat',
}
this.api.get( {
+ formatversion: 2,
action: 'query',
prop: 'categories',
cllimit: this.limit,
titles: 'Category:' + input
} ).done( function ( res ) {
- var page,
- categories = [];
+ var categories = [];
- for ( page in res.query.pages ) {
- if ( parseInt( page, 10 ) > -1 ) {
- if ( $.isArray( res.query.pages[ page ].categories ) ) {
- categories.push.apply( categories, res.query.pages[ page ].categories.map( function ( category ) {
+ $.each( res.query.pages, function ( index, page ) {
+ if ( !page.missing ) {
+ if ( $.isArray( page.categories ) ) {
+ categories.push.apply( categories, page.categories.map( function ( category ) {
return category.title;
} ) );
}
}
- }
+ } );
deferred.resolve( categories );
} ).fail( deferred.reject.bind( deferred ) );